import { ArticleDetail } from '@/types/data'
import { ArticleAction, ArticleInitType } from '@/types/store'

const initValue: ArticleInitType = { info: {} as ArticleDetail }

export default function articles(
  prevState = initValue,
  action: ArticleAction
): ArticleInitType {
  switch (action.type) {
    case 'article/getArticleDetail':
      return {
        ...prevState,
        info: action.payload,
      }
    default:
      return prevState
  }
}
